
package com.xiaoye.qbproject.domain.wiki;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xiaoye.qbproject.converter.ContentInfoExcelConverter;
import com.xiaoye.qbproject.converter.ListRefToJsonConverter;
import com.xiaoye.qbproject.converter.ListToJsonConverter;
import com.xiaoye.qbproject.handle.ContentInfoToStringTypeHandler;
import com.xiaoye.qbproject.handle.ListToRefTypeHandler;
import com.xiaoye.qbproject.handle.ListToStringTypeHandler;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@TableName(value = "QB_SUBJECT_WIKI")
@Data
public class QbSubjectWiki implements Serializable {
    @ExcelProperty("id")
    @TableId(value = "ID")
    private String id;

    @TableField(value = "ALBUMS", typeHandler = ListToStringTypeHandler.class)
    @ExcelProperty(value = "专辑", converter = ListToJsonConverter.class)
    private List<String> albums;

    @ExcelProperty("官方链接")
    @TableField(value = "CANONICAL_LINK")
    private String canonicalLink;

    @TableField(value = "CATEGORIES",typeHandler = ListToStringTypeHandler.class)
    @ExcelProperty(value = "类别", converter = ListToJsonConverter.class)
    private List<String> categories;

    @TableField(value = "CONTENT_INFO", typeHandler = ContentInfoToStringTypeHandler.class)
    @ExcelProperty(value = "内容", converter = ContentInfoExcelConverter.class)
    private ContentInfo contentInfo;

    @ExcelProperty("关键词")
    @TableField(value = "KEYWORDS")
    private String keywords;

    @ExcelProperty("语言")
    @TableField(value = "LANG")
    private String lang;

    @ExcelProperty("发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "RELEASE_TIME")
    private String releaseTime;

    @ExcelProperty("qid")
    @TableField(value = "QID")
    private String qid;

    @TableField(value = "\"REFERENCES\"",typeHandler = ListToRefTypeHandler.class)
    @ExcelProperty(value = "引用", converter = ListRefToJsonConverter.class)
    private List<Reference> references;

    @ExcelProperty("概述")
    @TableField(value = "INTRO")
    private String intro;

    @ExcelProperty("来源")
    @TableField(value = "SOURCE")
    private String source;
    /**
     * 封面
     */
    @ExcelProperty("缩略图链接")
    @TableField(value = "COVER")
    private String cover;

    @ExcelProperty("标题")
    @TableField(value = "TITLE")
    private String title;

    @ExcelProperty("类型")
    @TableField(value = "TYPE")
    private String type;

    @ExcelProperty("网址")
    @TableField(value = "URL")
    private String url;


    @ExcelProperty("描述")
    @TableField(value = "REMARK")
    private String remark;

    @TableField(exist = false)
    @ExcelProperty("描述信息")
    private String description;
    /**
     * 创建时间
     */
    @ExcelProperty("创建时间")
    @TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @ExcelProperty("更新时间")
    @TableField(value = "UPDATE_TIME", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 任务id
     */
    @ExcelProperty("任务id")
    @TableField(exist = false)
    private String tid;


    @ExcelProperty("正文图片")
    @TableField(exist = false)
    private String contentImages;

    /**
     * 专题id
     */
    @TableField(value = "SUBJECT_ID")
    private String subjectId;

}
